#include <iostream>
#define int long long 
using namespace std;

signed main() {
    int n;
    cin >> n;
    int sum = 0;
    int x; 
    for (int i = 0; i < n; ++i) {
        cin >> x;
        sum += x;
    }
    if (sum % 2 != 0) {
        cout << 0 << endl;
    } else {
        cout << n * (n - 1) / 2 << endl;
    }
    return 0;
}
